package cn.amaake.magicplugin.nacos.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import com.alibaba.nacos.api.config.ConfigType;
/**
 * nacos 配置文件
 */
@ConfigurationProperties(prefix = "magic-api.nacos")
public class NacosConfig {

    /**
     * 是否开启配置管理
     */
    private boolean enableConfig = false;

    /**
     * 是否开启服务注册和发现
     */
    private boolean enableDiscovery = false;

    /**
     * 是否开启启动获取配置
     */
    private boolean enableStartConfig = false;

    /**
     * nacos 服务地址
     */
    private String serverAddr;

    /**
     * 配置ID
     */
    private String dataId;

    /**
     * 配置分组 默认为 DEFAULT_GROUP
     */
    private String group = "DEFAULT_GROUP";

    /**
     * 读取配置超时时间 默认为3000
     */
    private long timeout = 3000;

    /**
     * 服务名
     */
    private String serviceName;

    /*
    * 命名空间
    * */
    private String namespace = "";

    /**
     * 集群名
     */
    private String clusterName;

    /**
     * 指定本机ip针对多网卡服务的自定义设置ip，默认会获取本地随机某一个ip
     * 查找所有网卡地址，必须非回路（loopback）地址、非局域网地址（siteLocal）、IPv4地址
     */
    private String ip;

    private ConfigType type = ConfigType.PROPERTIES;

    private boolean enabledAuth;

    private String username;

    private String password;

    /*
    * 是否开启dubbo
    * */
    private boolean enabledDubbo = false;

    /*
    * Dubbo 包名前缀
    * 默认com.magicapirpc.
    * */
    private String dubboPrefix = "com.magicapirpc.";

    private String dubboProtocolName = "tri";

    private int dubboProtocolPort = -1;

    private int dubboProtocolThreads = 200;

    public String getDubboProtocolName() {
        return dubboProtocolName;
    }

    public boolean isEnableStartConfig() {
        return enableStartConfig;
    }

    public void setEnableStartConfig(boolean enableStartConfig) {
        this.enableStartConfig = enableStartConfig;
    }

    public void setDubboProtocolName(String dubboProtocolName) {
        this.dubboProtocolName = dubboProtocolName;
    }

    public int getDubboProtocolPort() {
        return dubboProtocolPort;
    }

    public void setDubboProtocolPort(int dubboProtocolPort) {
        this.dubboProtocolPort = dubboProtocolPort;
    }

    public int getDubboProtocolThreads() {
        return dubboProtocolThreads;
    }

    public void setDubboProtocolThreads(int dubboProtocolThreads) {
        this.dubboProtocolThreads = dubboProtocolThreads;
    }

    public String getDubboPrefix() {
        return dubboPrefix;
    }

    public void setDubboPrefix(String dubboPrefix) {
        this.dubboPrefix = dubboPrefix;
    }

    public boolean isEnabledDubbo() {
        return enabledDubbo;
    }

    public void setEnabledDubbo(boolean enabledDubbo) {
        this.enabledDubbo = enabledDubbo;
    }

    public boolean isEnabledAuth() {
        return enabledAuth;
    }

    public void setEnabledAuth(boolean enabledAuth) {
        this.enabledAuth = enabledAuth;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public ConfigType getType() {
        return type;
    }

    public void setType(ConfigType type) {
        this.type = type;
    }

    private boolean remoteFirst;

    public boolean isRemoteFirst() {
        return remoteFirst;
    }

    public void setRemoteFirst(boolean remoteFirst) {
        this.remoteFirst = remoteFirst;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public boolean isEnableConfig() {
        return enableConfig;
    }

    public void setEnableConfig(boolean enableConfig) {
        this.enableConfig = enableConfig;
    }

    public boolean isEnableDiscovery() {
        return enableDiscovery;
    }

    public void setEnableDiscovery(boolean enableDiscovery) {
        this.enableDiscovery = enableDiscovery;
    }

    public String getServerAddr() {
        return serverAddr;
    }

    public void setServerAddr(String serverAddr) {
        this.serverAddr = serverAddr;
    }

    public String getDataId() {
        return dataId;
    }

    public void setDataId(String dataId) {
        this.dataId = dataId;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public long getTimeout() {
        return timeout;
    }

    public void setTimeout(long timeout) {
        this.timeout = timeout;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getClusterName() {
        return clusterName;
    }

    public void setClusterName(String clusterName) {
        this.clusterName = clusterName;
    }

    public String getNamespace() {
        return namespace;
    }

    public void setNamespace(String namespace) {
        this.namespace = namespace;
    }
}
